package com.soft.line.controller;

import com.soft.line.entity.LasCodeItem;
import com.soft.line.service.CodeDetailService;
import com.soft.line.util.exception.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(description = "内部代码")
@Slf4j
@RestController
public class CodeDetailController {

    @Autowired
    private CodeDetailService codeDetailService;

    @ApiOperation(value = "菜单按钮列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "codeType", value = "codeType", required = true, dataType = "String", paramType = "path")
    })
    @GetMapping("codeDetail/{codeType}")
    public CommonResult<List<LasCodeItem>> getCodeDetailByCodeType(@PathVariable("codeType") String codeType) {
        return CommonResult.success(codeDetailService.selectByCodeType(codeType));
    }
}
